﻿<UserControl x:Class="FR.SAFTAnalyser.Views.Tools.DocumentPartsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:cinch="clr-namespace:Cinch;assembly=Cinch.WPF"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Background="{DynamicResource Background}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Border BorderThickness="0 0 0 2" BorderBrush="Black" Grid.Row="0">
            <TextBlock VerticalAlignment="Stretch" TextWrapping="Wrap" Margin="3"
                   Text="Permite abrir as diferentes partes do ficheiro SAF-T PT" />
        </Border>

        <ListView x:Name="parts" Grid.Row="1" BorderThickness="0"
                  ItemsSource="{Binding SaftParts}"
                  SelectedItem="{Binding SaftPart}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <cinch:EventToCommandTrigger 
                        Command="{Binding DoOpenSaftPartCommand}" CommandParameter="{Binding ElementName=parts,Path=SelectedValue}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <ListView.View>
                <GridView>
                    <GridView.ColumnHeaderContainerStyle>
                        <Style>
                            <Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>
                        </Style>
                    </GridView.ColumnHeaderContainerStyle>
                    <GridViewColumn Header="Image">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Image Source="{Binding ImageSource}"  />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Name">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Description}" TextAlignment="Left"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>

        <Border BorderThickness="0 0 0 2" BorderBrush="Black" Grid.Row="2">
            <TextBlock VerticalAlignment="Stretch" TextWrapping="Wrap" Margin="3"
                   Text="Permite abrir as diferentes partes do ficheiro de existências" />
        </Border>
        
        <ListView x:Name="stocks" Grid.Row="3" BorderThickness="0"
                  ItemsSource="{Binding StockParts}"
                  SelectedItem="{Binding StockPart}">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <cinch:EventToCommandTrigger 
                        Command="{Binding DoOpenStockPartCommand}" CommandParameter="{Binding ElementName=stocks,Path=SelectedValue}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
            <ListView.View>
                <GridView>
                    <GridView.ColumnHeaderContainerStyle>
                        <Style>
                            <Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>
                        </Style>
                    </GridView.ColumnHeaderContainerStyle>
                    <GridViewColumn Header="Image">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Image Source="{Binding ImageSource}"  />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Name">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Description}" TextAlignment="Left"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>
